package com.xdf.teacher.adapter;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.xdf.teacher.R;
import com.xdf.teacher.entity.RoomList;
import com.xdf.teacher.entity.User;

import net.neiquan.applibrary.base.MyBaseAdapter;
import net.neiquan.okhttp.NetCallBack;
import net.neiquan.okhttp.ResultModel;

import org.haitao.common.utils.ToastUtil;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * 作者 ： dyj
 * 时间 ： 2016/12/29.
 */

public class HomeListAdapter extends MyBaseAdapter<RoomList.DataBean, HomeListAdapter.ViewHolder> {

    public HomeListAdapter(Activity context, List data) {
        super(context, data);
    }


    @Override
    protected ViewHolder getViewHolder() {
        return new ViewHolder(mInflater.inflate(R.layout.item_home, null));
    }

    @Override
    protected void onBindViewHolder_(ViewHolder holder, final int position) {
//        if(position%2==0){
//            holder.mStatusView.setBackgroundColor(context.getResources().getColor(R.color.lesson_list));
//            holder.mStatusTv.setTextColor(context.getResources().getColor(R.color.lesson_list));
//            holder.mStatusTv.setText("空闲中");
//        }else{
//            holder.mStatusView.setBackgroundColor(context.getResources().getColor(R.color.app_color));
//            holder.mStatusTv.setTextColor(context.getResources().getColor(R.color.app_color));
//            holder.mStatusTv.setText("正在使用");
//        }
        if (data != null && data.size() > 0) {
            RoomList.DataBean dataBean = data.get(position);
            holder.mLessonName.setText(dataBean.getRoom_name());
            holder.mStatusTv.setTextColor(context.getResources().getColor(R.color.app_color));
            holder.mStatusTv.setText("正在使用");
        }

    }


    static class ViewHolder extends RecyclerView.ViewHolder {
        @InjectView(R.id.mStatusView)
        View mStatusView;
        @InjectView(R.id.mLessonName)
        TextView mLessonName;
        @InjectView(R.id.mStatusTv)
        TextView mStatusTv;


        ViewHolder(View view) {
            super(view);
            ButterKnife.inject(this, view);
        }
    }
}
